/**
 * FtpFileNode.java
 * @author: liuex
 * 2007-12-25 ����11:13:34
 *
 * note: 
 */
package org.lex.ftp.ui.explorer.directory;

import javax.swing.tree.DefaultMutableTreeNode;

import org.lex.net.ftp.IFTPFile;

public class FTPFileNode extends DefaultMutableTreeNode {
	private static final IFTPFile[] EMPTY = new IFTPFile[0];
	private String fileName = null;

	public FTPFileNode(String name) {
		super(name);
		this.fileName = name;
	}

	public void setContents(IFTPFile[] list) {
		this.removeAllChildren();
		if (null == list)
			list = EMPTY;
		for (int i = 0; i < list.length; i++) {
			IFTPFile file = list[i];
			if (true == file.isDirectory())
				this.add(new FTPFileNode(file.getName()));
		}
	}

	public String getFileName() {
		return fileName;
	}
}
